//
//  PhotoCVCell.swift
//  NewDelivery
//
//  Created by 天下宅 on 2016/11/9.
//  Copyright © 2016年 天下宅. All rights reserved.
//

import UIKit

enum PhotoCVCellState {
    case none,optional,selected
}

class PhotoCVCell: UICollectionViewCell {
    
    private var IV = UIImageView()
    private var selectIV = UIImageView()
    
    var image:UIImage?
    {
        set(newValue){
            IV.image = newValue
        }
        get{
            return IV.image
        }
    }
    
    var status = PhotoCVCellState.none
    {
        didSet{
            switch status {
            case .none:
                selectIV.isHidden = true
                IV.image = UIImage.init(named: "拍照")
            case .optional:
                selectIV.isHidden = true
            case .selected:
                selectIV.isHidden = false

            }
        }
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.addSubview(IV)
        IV.snp.makeConstraints { (make) in
            make.top.right.bottom.left.equalToSuperview()
        }
        self.addSubview(selectIV)
        selectIV.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-8)
            make.top.equalToSuperview().offset(8)
            make.width.height.equalTo(20)
        }
        selectIV.image = UIImage.init(named: "确认")
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    

}
